package cn.tedu.luban.order.main.repository.impl;

import cn.tedu.luban.order.main.converter.OrderLogConverter;
import cn.tedu.luban.order.main.dao.OrderLogDAO;
import cn.tedu.luban.order.main.repository.OrderLogRepository;
import cn.tedu.luban.order.protocol.bo.OrderLogBO;
import cn.tedu.luban.order.protocol.dos.OrderLogDO;
import cn.tedu.luban.order.protocol.param.OrderLogParam;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

@Repository
public class OrderLogRepositoryImpl implements OrderLogRepository {
    @Autowired(required = false)
    private OrderLogDAO orderLogDAO;
    @Autowired
    private OrderLogConverter orderLogConverter;
    @Override public List<OrderLogBO> getOrderLogByOrderNo(String orderNo) {
        List<OrderLogDO> orderLog = this.orderLogDAO.getOrderLogByOrderNo(orderNo);
        return this.orderLogConverter.dos2bos(orderLog);
    }

    @Override public void saveOrderLog(OrderLogParam param) {
        OrderLogDO orderLogDO = this.orderLogConverter.param2do(param);
        this.orderLogDAO.saveOrderLog(orderLogDO);
    }
}
